package com.fqgj.report.statistics.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.report.statistics.dao.BiGradeStatDao;
import com.fqgj.report.statistics.entity.BiGradeStatEntity;
import com.fqgj.report.statistics.entity.BiGradeStatisticEntity;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: ykpbean
 * Date: 2017-10-18
 * Time: 14:28:32.025
 */

@Repository
public class BiGradeStatDaoImpl extends AbstractBaseMapper<BiGradeStatEntity> implements BiGradeStatDao {
    @Autowired
    @Qualifier("sqlSessionFactory2")
    private SqlSessionFactory sqlSessionFactory;

    @Override
    public List<BiGradeStatisticEntity> selectRiskGradeStatistic(String startDate, String endDate, Long eventId, Integer versionType, String source, Integer borrowType, String scoreField) {

        Map<String, Object> param = new HashMap<>();
        param.put("startDate", startDate);
        param.put("endDate", endDate);
        param.put("eventId", eventId);
        param.put("versionType", versionType);
        param.put("source", source);
        param.put("borrowType", borrowType);
        param.put("scoreField", scoreField);
        SqlSession sqlSession = new SqlSessionTemplate(sqlSessionFactory);
        return sqlSession.selectList(getStatement(".selectRiskGradeStatistic"),param);
    }
}